home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / dsp / fteyaltr.z / fteyaltr / fftoutc.c < prev    next >
C/C++ Source or Header  |  1991-06-10  |  2KB  |  120 lines

  1. /* ------------------------- fftoutc.c -------------------------------- */
  2. /*                                    */
  3. /* Author:    Eyal Lebedinsky                        */
  4. /* Date:    May 1990                        */
  5. /* Version:    9 June 1991                        */
  6. /*                                    */
  7. /* called from fftg.c and generates C output                */
  8. /* uses the header "fftsubs.h"                         */
  9. /*                                    */
  10. /* This program is released into the public domain.            */
  11. /*                                    */
  12. /*----------------------------------------------------------------------*/
  13.  
  14. #include <stdio.h>
  15.  
  16. static int    stmts = 0, file = 0;
  17. static char    fname[256], ename[256];
  18.  
  19. void
  20. start_fft (file_name, ep_name)
  21. char    *file_name, *ep_name;
  22. {
  23.     if (file_name) {
  24.         strcpy (ename, ep_name);
  25.         strcpy (fname, file_name);
  26.         strcat (fname, "a.c");
  27.         file = 0;
  28.     }
  29.  
  30.     freopen (fname, "wt", stdout);
  31.     printf ("#include \"fftsubs.h\"\n");
  32.     printf ("void %s(){\n", ename);
  33.     printf ("init\n");
  34.     stmts = 0;
  35. }
  36.  
  37. void
  38. end_fft (file_name, ep_name)
  39. char    *file_name, *ep_name;
  40. {
  41.     printf ("}\n");
  42.     close (stdout);
  43. }
  44.  
  45. void
  46. break_fft (n)
  47. int    n;
  48. {
  49.     stmts += n;
  50.     if (stmts > 1000) {
  51.         ++fname[strlen (fname) - 3];
  52.         if (file++)
  53.             ++ename[strlen (ename) - 1];
  54.         else
  55.             strcat (ename, "b");
  56.         printf ("%s();\n", ename);
  57.         printf ("}\n");
  58.         start_fft (NULL, NULL);
  59.     }
  60. }
  61.  
  62. void
  63. fft1 (i1)
  64. int    i1;
  65. {
  66.     printf ("_fft1(%d)\n", i1);
  67.     break_fft (1);
  68. }
  69.  
  70. void
  71. fft2 (i1, i2)
  72. int    i1, i2;
  73. {
  74.     printf ("_fft2(%d,%d)\n", i1, i2);
  75.     break_fft (7);
  76. }
  77.  
  78. void
  79. fft3 (i1, i3, i4)
  80. int    i1, i3, i4;
  81. {
  82.     printf ("_fft3(%d,%d,%d)\n", i1, i3, i4);
  83.     break_fft (14);
  84. }
  85.  
  86. void
  87. fft4 (i1, i2, i3, i4, cc1)
  88. int    i1, i2, i3, i4, cc1;
  89. {
  90.     printf ("_fft4(%d,%d,%d,%d,0x%04x)\n", i1, i2, i3, i4, cc1);
  91.     break_fft (17);
  92. }
  93.  
  94. void
  95. fft5 (i1, i2, i3, i4, i5, i6, i7, i8, sm1, sp1, cc1, sm3, sp3, cc3, ind)
  96. int    i1, i2, i3, i4, i5, i6, i7, i8, sm1, sp1, cc1, sm3, sp3, cc3, ind;
  97. {
  98.     printf ("_fft5(%d,%d,%d,%d,%d,%d,%d,%d,",
  99.         i1, i2, i3, i4, i5, i6, i7, i8);
  100.     printf ("0x%04x,0x%04x,0x%04x,0x%04x,0x%04x,0x%04x,%d)\n",
  101.         sm1, sp1, cc1, sm3, sp3, cc3, ind);
  102.     break_fft (50);
  103. }
  104.  
  105. void
  106. fft7 (i1, i2)
  107. int    i1, i2;
  108. {
  109.     printf ("_fft7(%d,%d)\n", i1, i2);
  110.     break_fft (4);
  111. }
  112.  
  113. void
  114. fft8 (i1, i2, i3)
  115. int    i1, i2, i3;
  116. {
  117.     printf ("_fft8(%d,%d,%d)\n", i1, i2, i3);
  118.     break_fft (8);
  119. }
  120.